package com.example.zhilongzhang.constructionpayapp.method.bluetooth;

import android.app.Activity;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.AsyncTask;

import java.util.List;

public class ToothMethod {
    private AsyncTask mConnectTask;
    /**
     * 检查蓝牙状态，如果已打开，则查找已绑定设备
     *
     * @return
     */
    public static boolean checkBluetoothState(Activity mContext) {
        if (BluetoothUtil.isBluetoothOn()) {
            return true;
        } else {
            BluetoothUtil.openBluetooth(mContext);
            return false;
        }
    }
    public static BluetoothDevice getList(){
        List<BluetoothDevice> printerDevices = BluetoothUtil.getPairedDevices();
        if (printerDevices.size()>0){
            return printerDevices.get(0);
        }
        return null;
    }
    public static boolean checkBluetoothState2(Activity mContext) {
        if (BluetoothUtil.isBluetoothOn()) {
            return true;
        } else {
            return false;
        }
    }
}
